<template>
  <div>
    <el-dialog
    v-model="show"
    title="操作日志"
    width="700"
    :before-close="handleClose"
  >
  <mytable :fields="fields" ref="tableRef"  :values="values" :handle="false" api="changeLog" class="m_t_16"
        :isSelection="false">
        <template  v-slot:online="{row}">
        <span>{{ row.online==1?'上线':row.online==2?'下线':row.online==3?'创建':row.online==4?'编辑':row.online==5?'查看':'删除'}}</span>
        </template>
      </mytable>
  </el-dialog>
  </div>
</template>

<script lang='ts'>
import {defineComponent, reactive, toRefs,onBeforeMount,watch,ref} from 'vue'
interface item {
  label: string,
  prop: string,
}
interface dataType{
    fields:item[],
    show:boolean,

}
export default defineComponent({
name:'',
props:{
    values:{
        type: Object,
      default: {},
    }
},
setup(props: any,{ emit }: any){
const data:dataType = reactive({
    show:false,
    fields:[
        {
            label:'操作事项',
            prop:'online',
        },
        {
            label:'操作人',
            prop:'createdName',
        },
        {
            label:'操作时间',
            prop:'createdTime',
        },
    ],
})
const tableRef=ref()
onBeforeMount(()=>{
})
const methods={
    handleClose(){
        data.show=false
        emit("logHandleClose");
    },
    getData(){
      data.show=true
      if(tableRef.value){
          tableRef.value.handleCurrentChange(1)
        }
    }
};
  //  // 监听props的变化
  //  watch(() => props.values, (newValue, oldValue) => {
  //     if (props.values.bizId) {
  //       data.show=true 
  //       if(tableRef.value){
  //         tableRef.value.handleCurrentChange(1)
  //       }
  //     }
  //   }, { immediate: true, deep: true });
return {
...toRefs(data),
...methods,tableRef
}
}
})
</script>
<style scoped lang='scss'>
</style>